#!/usr/bin/env node

const fs  = require('fs'),
      src = process.argv[2],
      dst = process.argv[3];
//
//流是同步
//流操作事件，data事件读取，on读取完成

let srcStream = fs.createReadStream(src),
    dstStream = fs.createWriteStream(dst);

srcStream.pipe(dstStream);

dstStream.on('close',()=>{
  fs.chmodSync(dst,fs.statSync(src).mode);
});
